package com.example.hellomp.controller;

import com.example.hellomp.entity.Goods;
import com.example.hellomp.service.GoodsService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Tag(name = "产品信息管理")
@RequestMapping("/product")
public class ProductController {
    @Autowired
    private GoodsService goodsService;

    @GetMapping("list")
    @Operation(summary = "根据id获取商品信息")
    public Goods getById(@Parameter(description = "商品id")
                         @RequestParam Long id){
        Goods goods = goodsService.getById(id);
        return goods;
    }
}
